package cn.edu.ldu.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.DatagramPacket;

public class L {

    public static void OK(Object s, Class c){
        Logger log = LoggerFactory.getLogger(c);
        log.info("Action:" + s);
    }

//    public static Logger OK(JSONObject object, Class c){
//        Logger log = LoggerFactory.getLogger(c);
//        for(String str : object.keySet()){
//
//        }
//        return
//    }

    public static void OK(DatagramPacket packet, Class c, int inout){
        Logger log = LoggerFactory.getLogger(c);
        if(inout == 0){
            log.info("<== data:"+ Translate.ByteToObject(packet.getData()));
            log.info("<== length:"+ packet.getLength());
            log.info("<== address:"+ packet.getSocketAddress());
        }else {
            log.info("==> data:"+ Translate.ByteToObject(packet.getData()));
            log.info("==> length:"+ packet.getLength());
            log.info("==> address:"+ packet.getSocketAddress());
        }
    }

}
